<template>
  <div class="index" v-loading.fullscreen.lock="bodyloading">
    <div class="main">
      <div>
        <p class="tit">申请人：</p>
        <p>
          {{ materialsApply.signUserName }}({{ materialsApply.signUserCode }})
        </p>
      </div>
      <div>
        <p class="tit">申请时间：</p>
        <p>{{ materialsApply.signTime }}</p>
      </div>
      <div>
        <p class="tit">物料申请单号：</p>
        <p>{{ materialsApply.signTime }}</p>
      </div>
    </div>
    <div class="prdlist">
      <div v-for="item in materials" :key="item.modelCode">
        <div class="top">
          <div class="img">
            <img :src="item.picAddr" alt="" />
          </div>
          <div class="text">
            <p class="tit">{{ item.modelName }}</p>
            <p class="code">{{ item.modelCode }}</p>
            <p class="desc">物料描述：{{ item.modelDis }}</p>
          </div>
        </div>
        <div class="bottom">
          <p>申请数量</p>
          <p>x{{ item.number }}</p>
        </div>
        <div class="bottom" v-if="item.approvalNumber">
          <p>审批数量</p>
          <p>x{{ item.approvalNumber }}</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import {
  materialsApplyDetails,
} from "../../api/app.js";
export default {
  name: "Index",
  components: {},

  data() {
    return {
      header: {
        show: true,
        return: true,
        search: false,
        title: "物料申请详情",
        home: "/index",
        close: false,
      },
      isHome: false,
      bodyloading: false,
      materials: "", //物料信息
      materialsApply:"",
      applyId:this.$route.query.applyId,
    };
  },

  created() {
    this.getdetail();
  },
  mounted() {},

  methods: {
    getdetail() {
      this.bodyloading = true;
      let json = {
        applyId: this.applyId,
      };
      materialsApplyDetails(json).then((res) => {
        // console.log(res);
        if ((res.code = 200)) {
          this.materials = res.data.materials;
          this.materialsApply = res.data.materialsApply;
        }
        this.bodyloading =  false
      });
    },
  },
};
</script>

<style lang="scss" scoped>
.index {
  font-size: 0.14rem;
  > div {
    width: 95vw;
    margin: 0 auto;
    border-radius: 0.03rem;
    background-color: #fff;
    margin-bottom: 0.1rem;
    padding-bottom: 0.05rem;
  }

  .main {
    overflow: hidden;
    .title {
      margin: 0;
      font-size: 0.14rem;
      display: block;
      width: 100%;
      margin-top: 0.1rem;
      font-weight: 700;
      padding: 0 0.15rem;
      padding-bottom: 0.1rem;
      box-sizing: border-box;
      border-bottom: 1px solid #eee;
    }
    > div {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      position: relative;
      line-height: 0.3rem;
      padding: 0 0.15rem;
      box-sizing: border-box;
      p{
        margin:0;
      }
      .tit {
        width: 7em;
        text-align: left;
      }
      s {
        text-decoration: none;
        color: red;
      }
      .icon {
        position: absolute;
        font-size: 0.14rem;
        position: absolute;
        right: 0.05rem;
      }
    }
  }
  .prdlist {
    background: none;
    margin-bottom: 0.05rem;
    > div {
      padding: 0.1rem;
      box-sizing: border-box;
      border-radius: 0.03rem;
      background-color: #fff;
      margin-bottom: 0.1rem;
      &:last-child {
        margin-bottom: 0;
      }
      .top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        .img {
          width: 0.7rem;
          height: 0.7rem;
          img {
            width: 100%;
            height: 100%;
            display: flex;
          }
        }
        .text {
          width: 2.3rem;
          p {
            margin: 0;
          }
          .tit {
            color: #f40;
          }
          .code {
            color: #666;
            font-size: 0.12rem;
            margin: 0.05rem 0;
          }
          .desc {
            color: #333;
          }
        }
      }
      .bottom {
        display: flex;
        justify-content: space-between;
        align-items: center;
        p {
          margin: 0;
        }
      }
    }
  }
}
</style>
